<template>
	<view class="show-box-top">
		<view v-if="list.length != 0">
			<view class="item-recold" v-for="item in list" :key="item.id">
				<view class="btm-content">
					<view class="btm-label">提现状态：<text>{{ item.status | statusText }}</text></view>
					<view class="btm-label">提现金额：<text>¥{{ item.amount }}</text></view>
					<view class="btm-label">申请日期：<text>{{ item.times }}</text></view>
				</view>
			</view>
		</view>
		
		<view class="text-lg" style="text-align: center;padding-top: 20rpx;" v-else>
			<text>暂无提现记录</text>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page: 1,
				list: [],
				total: 0,
			}
		},
		onLoad() {
			this.init()
		},
		filters:{
			statusText(status) {
				let text
				if(status == 0) text = '待审核';
				if(status == 1) text = '通过';
				if(status == 2) text = '拒绝';
				
				return text
			}
		},
		methods: {
			init() {
				uni.showLoading()
				let { page, total } = this;
				let to_shop_id = uni.getStorageSync('userShopId');
				this.$api.post({
					url: '/wanlshop.shop/shopDrawalList',
					data: { to_shop_id, page },
					success: res => {
						uni.hideLoading()
						this.total = res.count;
						this.list.push(...res.list)
					}
				})
			},
		},
		
		onReachBottom() {
			let { list, total } = this;
			if(list.length < total) {
				++this.page;
				this.init();
			}
		}
	}
</script>

<style scoped>
.show-box-top {
	padding: 20rpx;
	display: flex;
	flex-direction: column;
	width: 100%;
	box-sizing: border-box;
}
.item-recold {
	width: 100%;
	padding: 0 20rpx;
	box-sizing: border-box;
	background-color: white;
	margin-bottom: 20rpx;
	border-radius: 15rpx;
}
.recold-top {
	padding: 35rpx 0 15rpx;
	border-bottom: solid 1rpx #f1f1f1;
	font-size: 30rpx;
	line-height: 30rpx;
	font-weight: 500;
}
.btm-content {
	padding: 20rpx 0;
	display: flex;
	flex-direction: column;
}
.btm-label {
	display: flex;
	align-items: center;
	font-size: 28rpx;
	margin-bottom: 20rpx;
}
</style>
